package api

import (
	"github.com/gin-gonic/gin"
	"video/api/handler"
	"video/api/middleware"
)

func LoadRouter(r *gin.Engine) {

	r.Use(middleware.ApiRunTime())

	api := r.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("/register", handler.RegisterUser)
			user.POST("/login", handler.LoginUser)
			user.Use(middleware.Auth())
			user.POST("/addLikeLook", handler.AddLikeLookUser)
			user.POST("/delLikeLook", handler.DeleteLikeLookUser)
		}
		video := api.Group("/video")
		{
			video.POST("/add", handler.AddVideo)
			video.GET("/list", handler.ListVideo)
			video.POST("/incrlikenum", handler.IncrLikeNumVideo)
			video.POST("/updatelikenum", handler.UpdateLikeNumVideo)
		}
		comment := api.Group("/comment")
		{
			comment.POST("/add", handler.AddComment)
			comment.POST("/list", handler.ListComment)
		}
	}

}
